# Maintainer: Ignacio Casal Quinteiro <icq@gnome.org>

_realname=libgusb
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.4.3
pkgrel=1
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
pkgdesc="GLib wrapper around libusb1 (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-libusb"
         "${MINGW_PACKAGE_PREFIX}-json-glib"
         "${MINGW_PACKAGE_PREFIX}-glib2")
makedepends=("${MINGW_PACKAGE_PREFIX}-pkg-config"
             "${MINGW_PACKAGE_PREFIX}-meson"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-vala"
             "${MINGW_PACKAGE_PREFIX}-gtk-doc"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "${MINGW_PACKAGE_PREFIX}-cc")
options=('strip' '!debug' 'staticlibs')
license=("LGPL")
url="https://github.com/hughsie/libgusb"
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/hughsie/${_realname}/archive/${pkgver}.tar.gz")
sha256sums=('8c7b7305b74e2e8725b3db19a80f5daecc560b8b6875fa8e7f90278b4b9bdacd')

build() {
  rm -rf "${srcdir}/build-${MSYSTEM}"
  mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM}

  MSYS2_ARG_CONV_EXCL="--prefix=" \
  ${MINGW_PREFIX}/bin/meson.exe \
    --prefix="${MINGW_PREFIX}" \
    --buildtype plain \
    -Dintrospection=true \
    -Dvapi=true \
    -Dtests=false \
    -Ddocs=false \
    ../${_realname}-${pkgver}

  ${MINGW_PREFIX}/bin/meson.exe compile
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"
  DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/meson.exe install
}
